var api = require('../../../utils/api.js')
var $ = require('../../../utils/util.js')
var regeneratorRuntime = require('../../../utils/runtime.js')
var app = getApp()

Page({
  data: {
    report_id: 0,
    info: null,
    verify: '',

  },
  onLoad: function (options) {
    this.setData({
      report_id: options.report_id || 0,
      ticket_num: options.ticket_num ,
    })
    this.getInfo()
  },
  onShow: function () {

  },
  getInfo() { // 详情数据
    var params = {
      report_id: this.data.report_id,
      ticket_num: this.data.ticket_num ,
    }
    api.$get(api.repairsManage.info, params).then((res) => {
      this.setData({
        info: res.data,
        verify: res.data.verify
      })
    })
  },

  //##input 输入##
  input_handle(e) {
    this.setData({
      [e.currentTarget.dataset.key]: e.detail.value
    })
  },
  //##input 输入##


  updateHandle() { // 更新报修内容
    var params = {
      report_id: this.data.info.report_id,
      verify: this.data.verify
    }
    api.$post(api.repairsManage.update, params).then((res) => { 
      $.toast('更新成功')
      setTimeout(() => {
        $.linkurl('', 'back')
      }, 1500)
    })
  },

  
})